<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <script>
    let arr=[]
    let num
    while(arr.length<5){
      num=+prompt('请输入')
      if(num>0&&num<100){
        arr.push(num)
      }
    }
    console.log(arr);
    let total=0
    
  for(i=0;i<arr.length;i++){
    if(arr[i]>=18){
      document.write(`成年的年龄是${arr[i]}`);
    }
    total+=arr[i]

  }
  let average=total/arr.length
  document.write(`${total}${average}`);
  let max = arr[0]
    let min = arr[0]
    for (let i = 1; i < arr.length; i++) {
      if (max < arr[i]) {
        max = arr[i]
      }
      if (min > arr[i]) {
        min = arr[i]
      }
    }
    document.write(`最大值是: ${max} <br>`)
    document.write(`最小值是: ${min} <br>`)
  </script>

</body>
</html>